﻿namespace NTLib.Core.Shared
{
    using NTLib.Core.Manipulators;

    /// <summary>
    /// Define methods to manipulate a shared value
    /// </summary>
    public interface ISharedValue : ISealed
    {
        #region Properties

        /// <summary>
        /// Gets the name.
        /// </summary>
        string Name { get; }

        /// <summary>
        /// Gets the key.
        /// </summary>
        ISharedValueKey Key { get; }

        #endregion

        #region Methods

        /// <summary>
        /// Clears the value.
        /// </summary>
        void ClearLocalValue(ISharedObject obj);

        /// <summary>
        /// Gets the shared value if no local value set.
        /// </summary>
        T GetValue<T>(ISharedObject obj);

        /// <summary>
        /// Sets the value.
        /// </summary>
        bool SetLocalValue<T>(ISharedObject obj, T value);

        /// <summary>
        /// Sets the value shared by all the instance that have the shared Property.
        /// </summary>
        bool OverrideSharedValue<T>(T value);

        #endregion
    }
}
